Skip to content

feat(google-sheets): add filter support to read operation#3333

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/sheets-named-ranges
Feb 25, 2026
Merged

feat(google-sheets): add filter support to read operation#3333
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/sheets-named-ranges

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add client-side row filtering to Google Sheets Read operation
  • Filter by column name + value with match types: contains, exact, starts_with, ends_with
  • Fields are advanced-mode only — zero changes to basic mode or when filters aren't supplied
  • Uses existing OAuth scopes (no new credentials needed)

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 25, 2026 7:25pm

Request Review

@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/sheets-named-ranges branch from f7f3ce9 to 5ae7de4 Compare February 25, 2026 19:14
@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

Added client-side row filtering to Google Sheets Read operation (V2 only) with support for filtering by column name and value using four match types: contains, exact, starts_with, and ends_with.

  • Filter fields are advanced-mode only, ensuring zero impact on basic mode users
  • Case-insensitive matching for both column headers and filter values
  • Filtering preserves header row and only filters data rows
  • Returns header + matching rows when filter is applied
  • No new OAuth scopes required, uses existing credentials
  • Documentation files contain only automated import sorting and formatting changes

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean implementation of filtering logic with proper null checks, case-insensitive matching, and no breaking changes to existing functionality. All new fields are optional and backward-compatible.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/tools/google_sheets/read.ts Added client-side filtering with column name matching and multiple match types; implementation is clean and safe
apps/sim/tools/google_sheets/types.ts Added three filter-related fields to GoogleSheetsV2ToolParams interface with proper TypeScript typing
apps/sim/blocks/blocks/google_sheets.ts Added three filter UI fields (advanced mode only) and proper param handling with conditional spreading

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Google Sheets API Call] --> B{Response Received}
    B --> C[Extract values array]
    C --> D{Filter params provided?}
    D -->|No| H[Return all values]
    D -->|Yes filterColumn & filterValue| E{Values length > 1?}
    E -->|No| H
    E -->|Yes| F[Find column index in headers]
    F --> G{Column found?}
    G -->|No| H
    G -->|Yes| I[Apply match type filter]
    I --> J{Match Type?}
    J -->|contains| K[cellValue.includes filterVal]
    J -->|exact| L[cellValue === filterVal]
    J -->|starts_with| M[cellValue.startsWith filterVal]
    J -->|ends_with| N[cellValue.endsWith filterVal]
    K --> O[Filter rows]
    L --> O
    M --> O
    N --> O
    O --> P[Return header + filtered rows]
    H --> Q[Return response]
    P --> Q
Loading

Last reviewed commit: 5ae7de4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 95304b2 into staging Feb 25, 2026
12 checks passed
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

...(filterColumn ? { filterColumn: (filterColumn as string).trim() } : {}),
...(filterValue !== undefined && filterValue !== ''
? { filterValue: filterValue as string }
: {}),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter value not trimmed unlike all other params

Medium Severity

Every other user-supplied string parameter in transformForTool is .trim()-ed — spreadsheetId, sheetName, cellRange, title, sheetTitles, destinationSpreadsheetId, and even filterColumn on the line just above — but filterValue is passed through as-is. Accidental leading or trailing whitespace in the filter value input will cause the case-insensitive comparison in read.ts to silently return no matches (e.g., "exact" comparing " active " against "active").

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant